
package aula_io_stream;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class TesteEntrada {
    
     public static void main(String[] args) throws Exception {
         BufferedReader teclado = new BufferedReader (new InputStreamReader(System.in) );
         
         ArrayList<Integer> lista = new ArrayList<Integer>();
         Integer x;
         do{
             System.out.println("Digite um numero , e 0 para terminar ");
             x = new Integer (teclado.readLine());
             lista.add(x);             
         } while (x!=0);
         
         Collections.sort(lista, new Comparator<Integer>(){
         @Override
		public int compare (Integer a, Integer b){
             return a-b; }});
         
         for(Integer i : lista)System.out.println(i);
         
     }
    
}
